package com.gopay.bis.dao.payconfig.impl;


import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.springframework.stereotype.Repository;

import com.gopay.bis.dao.payconfig.BisEbankB2BConfigDAO;
import com.gopay.common.base.dao.impl.BaseDAOImpl;
import com.gopay.common.domain.bis.BisEbankB2BConfig;

@Repository("bisEbankB2bConfigDAO")
public class BisEbankB2BConfigDAOImpl extends BaseDAOImpl<BisEbankB2BConfig, String> implements
		BisEbankB2BConfigDAO {


	@Override
	public BisEbankB2BConfig findBisEbankB2BConfigByBank(String bank) {
		StringBuilder s = new StringBuilder("from ");	
	    s.append(" BisEbankB2BConfig ");
		s.append(" c where c.bankCode=:bankCode");
		
		Map<String, Object> param = new HashMap<String, Object>();
		param.put("bankCode", bank);
		List<BisEbankB2BConfig> list = findByHql(s.toString(), param);
		if(null == list || list.isEmpty()){
			return null;
		}
		return (BisEbankB2BConfig)list.get(0);
	}

}
